function createScope(self) {
  var localStorage = window.localStorage || {};
  var $scope = {};

  $scope.shouldSkipIntro = (window.location.pathname.replace('/','') !== '');
  $scope.cookieWarningVisible = localStorage.cookieWarningVisible !== 'false';

  $scope.categoryNames = [
    'Art and design',
    'Living and dying',
    'Power and identity',
    'Religion and belief',
    'Trade and conflict'
  ];

  $scope.scrollHelp = false;
  $scope.showIntroHelp = (localStorage.showIntroHelp !== 'false');

  $scope.hoverInfoObject = null;


  $scope.dismissCookieWarning = function() {
    $scope.cookieWarningVisible = false;
    localStorage.cookieWarningVisible = 'false';
  };

  $scope.dismissIntroHelp = function() {
    $scope.scrollHelp = false;
    localStorage.showIntroHelp = false;
  };


  $scope.toggle = function(key, value) {
    $scope[key] = ($scope[key] === value) ? null : value;
    $scope[key+'Toggled'] = $scope[key] !== null;
  };

  $scope.moveCameraUp = function() {
    if (self.cameraZMotion === 0) {
      self.cameraZTarget = null;
      self.cameraZMotion = -1;
    }
  };

  $scope.moveCameraDown = function() {
    if (self.cameraZMotion === 0) {
      self.cameraZTarget = null;
      self.cameraZMotion = 1;
    }
  };

  $scope.stopCameraMotion = function() {
    self.cameraZTarget = null;
    self.cameraZMotion = 0;
  };

  $scope.goToYear = function(year) {
    self.cameraZMotion = 0;
    self.cameraZTarget = self.mapYearToLandscapeZ(year) + 50;
  }

  $scope.advanceIntro = function(force) {
    $scope.introState = Math.min(4, $scope.introState + 1);
  };

  $scope.toggleMuted = function() {
    if (self.audioManager) {
      self.audioManager.toggleMuted();
    }
  };

  $scope.getMuted = function() {
    if (self.audioManager) {
      return self.audioManager.getMuted();
    }
    return true;
  };

  return $scope;
}

